package com.linln.common.config;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;


@Configuration
public class ReqImgFilterConfig implements WebMvcConfigurer {


    @Value("${img.path}")
    private String imgPath;
    @Value("${img.mapping}")
    private String imgMapping;

    @Value("${verification.path}")
    private String verificationPath;
    @Value("${verification.mapping}")
    private String verificationMapping;

    @Value("${businesslicense.path}")
    private String businesslicensePath;

    @Value("${physicalstore.path}")
    private String physicalstorePath;

    @Value("${constructionworkshop.path}")
    private String constructionworkshopPath;

    @Value("${technicianconstruction.path}")
    private String technicianconstructionPath;

    @Value("${businesslicense.mapping}")
    private String businesslicenseMapping;

    @Value("${physicalstore.mapping}")
    private String physicalstoreMapping;

    @Value("${constructionworkshop.mapping}")
    private String constructionworkshopMapping;

    @Value("${technicianconstruction.mapping}")
    private String technicianconstructionMapping;


    @Value("${editorimg.path}")
    private String editorimgPath;

    @Value("${editorimg.mapping}")
    private String editorimgMapping;


    @Value("${homeRotation.path}")
    private String homeRotationPath;

    @Value("${homeRotation.mapping}")
    private String homeRotationMapping;
    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        registry.addResourceHandler(imgMapping + "**").addResourceLocations("file:" + imgPath);
        registry.addResourceHandler(editorimgMapping + "**").addResourceLocations("file:" + editorimgPath);
        registry.addResourceHandler(verificationMapping + "**").addResourceLocations("file:" + verificationPath);
        registry.addResourceHandler(businesslicenseMapping + "**").addResourceLocations("file:" + businesslicensePath);
        registry.addResourceHandler(physicalstoreMapping + "**").addResourceLocations("file:" + physicalstorePath);
        registry.addResourceHandler(constructionworkshopMapping + "**").addResourceLocations("file:" + constructionworkshopPath);
        registry.addResourceHandler(technicianconstructionMapping + "**").addResourceLocations("file:" + technicianconstructionPath);
        registry.addResourceHandler(homeRotationMapping + "**").addResourceLocations("file:" + homeRotationPath);
    }
}
